<%--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF licenses this file to You under the Apache License, Version 2.0
    (the "License"); you may not use this file except in compliance with
    the License.  You may obtain a copy of the License at
   
         http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

<html:html>
<head>
<title><bean:message key="admincomments.title"/></title>
<link rel="stylesheet" href="<%=request.getContextPath() %>/default.css" type="text/css">
<html:base/>
</head>
<body>

<logic:notPresent name="org.apache.struts.action.MESSAGE" scope="application">
  <font color="red">
    ERROR:  Application resources not loaded -- check servlet container
    logs for error messages.
  </font>
</logic:notPresent>

<div id="header">
	<div id="logo">
		<h1>
			<html:img width="40" src="../images/EMPTY.GIF"/>
			<html:link page="/pages/home.jsp">Textbook Crossroads</html:link>
		</h1>
		<h2>Team 14 - LoneTree</h2>
	</div>
	<div id="menu">
		<ul>
			<li class="active"><html:link page="/pages/admindashboard.jsp">Dashboard</html:link></li>
			<li><html:link page="/pages/books.jsp">Books</html:link></li>
			<li><html:link page="/pages/courses.jsp">Courses</html:link></li>
			<li><html:link page="/pages/about.jsp">About</html:link></li>
			<li class="logon"><html:link action="/logout">LogOut</html:link></li> 
		</ul>
	</div>
</div>

<div id="content">
	<div id="sidebar">
			<div id="categories">
			<div id="archives" class="boxed">
				<h2>Admin Actions</h2>
				<div class="content">
					<ul>
			    		<li><html:link href="bookadmin.jsp"><bean:message
			            key="adminbook.link"/></html:link></li>
			            
			            <li><html:link action="/AdminCourses"><bean:message
			            key="admincourses.link"/></html:link></li>
			            
			            <li><html:link action="/AdminAccounts"><bean:message
			            key="adminaccounts.link"/></html:link></li>
			            
			            <li><html:link action="/AdminComments"><bean:message
			            key="admincomments.link"/></html:link></li>
					</ul>
				</div>
			</div>
		</div>
	</div>

	<div id="posts">
		<div class="post">
			<h2 class="title"><bean:message key="admincomments.heading"/></h2>
			<div class="meta">
				<p class="date">List of book and course comments:</p>
			</div>
			<div class="story">
				<h3><bean:message key="reportcomments.heading"/></h3>
				<logic:present name="reportedbookcomments">
					<logic:notEmpty name="reportedbookcomments">
						<table border="0" width="100%">
				        <logic:iterate id="bookcomment" name="reportedbookcomments" indexId="cnt">
				        	<tr>
								<td width="25">
							  		<bean:write name="bookcomment" property="user.username.usernameString" />
							  	</td>
							  	<td>
							  		<bean:write name="bookcomment" property="comment" />
							  	</td>
							  	<td>
							  		<html:link action="/AdminReportedComment" paramName="bookcomment" paramProperty="bookCommentId.bookCommentIdLong" paramId="reportedcomment">
							  		<bean:message key="modify.bookcomment"/>
							  		</html:link>
							  	</td>
							  	<td>
							  		<html:link action="/RemoveReportedComment" paramName="bookcomment" paramProperty="bookCommentId.bookCommentIdLong" paramId="reportedcomment">
							  		<bean:message key="remove.bookcomment"/>
						  			</html:link>
						  		</td>
				            </tr>
						</logic:iterate>
						</table>
					</logic:notEmpty>
					<logic:empty name="reportedbookcomments">
					    Database does not contain any flagged comments
					</logic:empty>
				</logic:present><br/>
				
				<h3><bean:message key="reportcoursecomments.heading"/></h3>
				<logic:present name="reportedcoursecomments">
					<logic:notEmpty name="reportedcoursecomments">
						<table border="0" width="100%">
				        <logic:iterate id="coursecomment" name="reportedcoursecomments" indexId="cnt">
				        	<tr>
								<td width="30">
							  		<bean:write name="coursecomment" property="user.username.usernameString" />
							  	</td>
							  	<td>
							  		<bean:write name="coursecomment" property="comment" />
							  	</td>
							  	<td>
							  		<html:link action="/AdminReportedComment" paramName="coursecomment" paramProperty="courseCommentId.courseCommentIdLong" paramId="reportedcomment">
							  		<bean:message key="comment.modify"/>
							  		</html:link>
							  	</td>
							  	<td>
							  		<html:link action="/RemoveReportedComment" paramName="coursecomment" paramProperty="courseCommentId.courseCommentIdLong" paramId="reportedcomment">
							  		<bean:message key="coursecomment.modify"/>
						  			</html:link>
						  		</td>
				            </tr>
						</logic:iterate>
						</table>
					</logic:notEmpty>
					<logic:empty name="reportedcoursecomments">
					    Database does not contain any flagged comments
					</logic:empty>
				</logic:present><br/>
			</div>
		</div>
	</div>
</div>

<div id="footer">
	<p id="copy">&copy;2007 LoneTree.</p>
	<p> (Andrew Lee | Bojan Martin | Dimeji Omikunle | Minghui Yu)</p>
</div>
</body>
</html:html>